<form id="pagerForm" method="post" action="">
	<input type="hidden" name="pageNum" value="{$pageNum}" />
	<input type="hidden" name="numPerPage" value="{$numPerPage}" />
	<input type="hidden" name="orderField" value="{$orderField}" />
	<input type="hidden" name="orderDirection" value="{$orderDirection}" />
	<input type="hidden" name="keywords" value="{$keywords}" />
	<input type="hidden" name="sfield" value="{$sfield}" />
	<input type="hidden" name="platform" value="91YUNGOU" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="" method="post" autocomplete="off">
		<input type="hidden" name="m" value="{$module_name}" />
		<input type="hidden" name="a" value="{$action_name}" />
	<div class="searchBar">
		<ul class="searchContent">
			<li style="width:210px;">
				<label style="width:60px;">关键字：</label>
				<input type="text" name="keywords" value="{$keywords}" style="width:120px;"/>
			</li>
			<li style="width:120px;">
			<select name="sfield" class="combox">
				<option value="all" {if $wherefields=='all'}selected="selected"{/if}>全部</option>
				<option value="userid" {if $wherefields=='userid'}selected="selected"{/if}>用户id</option>
				<option value="id" {if $wherefields=='id'}selected="selected"{/if}>ID</option>
				<option value="sn" {if $wherefields=='sn'}selected="selected"{/if}>订单编号</option>
			</select>
			<input type="hidden" name="sfield_name" value="id,userid,id,sn" />
			</li>
			<li>
				<select name="sel_status">
					<option value="ALL" {if $sel_status=='ALL'||empty($sel_status)}selected="selected"{/if}>全部订单状态</option>
<volist name="status" id="st">
					<option value="{$key}" {if $sel_status==(string)$key}selected="selected"{/if}>{$st}</option>
</volist>					
				</select>
			</li>
			<div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div>
		</ul>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="{:U('Order/add_msg')}&id={sid_dv}" target="dialog" width="580" height="350" rel="User_add" warn="请选择一个笔订单"><span>添加备注</span></a></li>
			<li><a class="edit" href="{:U('Order/show_msg')}&id={sid_dv}" target="dialog" width="580" height="350" warn="请选择一个笔订单"><span>查看备注</span></a></li>
			<li><a class="icon" href="javascript:$.printBox('w_list_print')"><span>打印</span></a></li>
			<li><a class="icon" target="selectedTodo" rel="o2oids[]" href="{:U('Order/add_depot')}" title="备货" warn="请选择一个笔订单"><span>备货</span></a></li>
			<li><a class="edit" onclick="o2o_print()"><span>打印出库单</span></a></li>
			<li><a class="edit" onclick="o2o_psdprint()"><span>打印快递单</span></a></li>
			<li><a class="icon selectedDo" rel="Order_add_depot" target="navTab" data="o2oids[]" href="{:U('Order/add_depot')}" title="备货" warn="请选择一个笔订单"><span>备货</span></a></li>
		</ul>
	</div>
	<div id="w_list_print">
	<table class="list" width="98%" targetType="navTab" layoutH="96">
		<thead>
			<tr>
				<th width="22"></th>
				<th colspan="5" align="center">基本信息</th>
				<th colspan="2" align="center">商户信息</th>
				<th colspan="5" align="center">客户信息</th>
				<th colspan="5" align="center">操作进度</th>
			</tr>
			<tr>
				<th width="22"><input type="checkbox" group="o2oids[]" class="checkboxCtrl"></th>
				<th width="60" orderField="id" {if $orderField=='id'}class="{$orderDirection}"{/if}>编号</th>
				<th width="100" orderField="sn" {if $orderField=='sn'}class="{$orderDirection}"{/if}>订单号</th>
				<th width="60" orderField="userid" {if $orderField=='userid'}class="{$orderDirection}"{/if}>用户ID</th>
				<th width="150" orderField="add_time" {if $orderField=='add_time'}class="{$orderDirection}"{/if}>创建时间</th>
				<th width="150" orderField="mtime" {if $orderField=='mtime'}class="{$orderDirection}"{/if}>更新时间</th>
				<th width="80" orderField="userid" {if $orderField=='userid'}class="{$orderDirection}"{/if}>云购商</th>
				<!-- <th width="80">委托</th>
				<th width="80">转交</th> -->
				<th width="80" orderField="amount" {if $orderField=='amount'}class="{$orderDirection}"{/if}>金额</th>
				<th width="80">用户ID</th>
				<th width="80">销售金额</th>
				<th width="150">支付</th>
				<th width="50">发票</th>
				<th width="50">配送</th>
				<th width="50" orderField="status" {if $orderField=='status'}class="{$orderDirection}"{/if}>状态</th>
				<!-- <th width="80" orderField="status" {if $orderField=='status'}class="{$orderDirection}"{/if}>支付</th> -->
				<th width="50" orderField="status" {if $orderField=='status'}class="{$orderDirection}"{/if}>配送</th>
				<th width="200">操作</th>
			</tr>
		</thead>
		<tbody>
{if $totalCount==0}
		<tr>
			<td colspan="13" align="center">暂无相关信息</td>
		</tr>
{else}
<volist name="list" id="vo">
			<tr target="sid_dv" rel="{$vo['id']}">
				<td><input name="o2oids[]" value="{$vo['id']}" type="checkbox"></td>
				<td>{$vo['id']}</td>
				<td><a title="查看" target="dialog" width="800" height="650" rel="Order_detailo2o_{$vo['id']}" href="{:U('Order/detailo2o',array('id'=>$vo['id']))}">{$vo['sn']}</a></td>
				<td>{$vo['userid']}</td>
				<td>{if empty($vo['add_time'])}-{else}{$vo['add_time']|date="Y-m-d H:i:s",###}{/if}</td>
				<td>{if empty($vo['mtime'])}-{else}{$vo['mtime']|date="Y-m-d H:i:s",###}{/if}</td>
				<td>{if empty($vo['userid'])}未受理{else}{$vo['userid']}{/if}</td>
				<!-- <td>{if $vo['pay_status']==0}-{elseif $vo['pay_status']==2}已委托{/if}</td>
				<td>{if $vo['ext']['move']['value']==1}已转交{elseif $vo['pay_status']==2}-{/if}</td> -->
				<td>{$vo['amount']/100|number_format=###,2,'.',''}</td>
				
				<td>{$vo['ext']['userid']['value']}</td>
				
				<td>{$vo['ext']['amount']['value']/100|number_format=###,2,'.',''}</td>
				<td>{if $vo['ext']['pay']['value']==1}在线支付{else}门店支付{/if} {if $vo['ext']['pay_status']['value']==0}未支付{elseif $vo['ext']['pay_status']['value']==2}已支付{/if}</td>
				<td>{if $vo['ext']['isfapiao']['value']==1}是{else}否{/if}</td>
				<td>{if $vo['ext']['kdps']['value']==1}门店{else}快递{/if}</td>
				<td>{$status[$vo['status']]}</td>
				<!-- <td>{$pay_status[$vo['pay_status']]}</td> -->
				 <td>{$shipping_status[$vo['shipping_status']]}</td>
				<td>
					<a title="{$vo['sn']} 查看" target="dialog" width="800" height="650" rel="Order_detailo2o_{$vo['id']}" href="{:U('Order/detailo2o',array('id'=>$vo['id']))}" class="btnInfo">查看</a>
					{if $vo['status']!=-10}
						{if $vo['status'] != 10}
						{if (!empty($vo['userid'])&&$vo['pay_status']==2)||$vo['ext']['move']['value']==1}
							<a title="{$vo['sn']}标记缺货" target="dialog" width="680" height="350" rel="Order_oos_{$vo['id']}" href="{:U('Order/oos',array('id'=>$vo['id']))}" class="btnEdit">标记缺货</a>
							
							<a title="{if $vo['status']==0}确认订单{else}订单已经确认{/if}" target="ajaxTodo" href="{:U('Order/status',array('id'=>$vo['id'],'status'=>'1'))}" {if $vo['status']==0}class="btnsk"{else}class="btnyqr"{/if}>确认</a>
							
							<a title="{$vo['sn']} 发货" target="dialog" width="500" height="200" rel="Order_sipping_{$vo['id']}" href="{:U('Order/sipping',array('id'=>$vo['id']))}" class="btnfh">发货</a>
							
							
						{/if}
						<!-- <a title="{$vo['sn']} 订单询价" target="navTab" rel="Order_suppliers_{$vo['id']}" href="{:U('Order/suppliers',array('ids'=>$vo['id']))}" class="btnLook">订单询价</a> -->
						<a title="{if $vo['status']!=-10}订单取消{else}订单已取消{/if}" target="ajaxTodo" href="{:U('Order/cancel',array('id'=>$vo['id']))}" {if $vo['status']!=-10}class="btnDel"{else}class="btnqx"{/if}>取消</a>
						{/if}
						<a target="_blank" href="{:U('Print/o2o_print',array('id'=>$vo['id']))}" title="打印出库单" class="btndy2" >出库</a>
						<a target="_blank" href="{:U('Print/o2o_psdprint',array('id'=>$vo['id']))}" title="打印快递单" class="btndy" >快递</a>
					{/if}
					<a href="{:U('Order/o2ofee',array('id'=>$vo['id']))}" title="{$vo['sn']} 订单结算" target="dialog" width="800" height="650" rel="Order_o2ofee_{$vo['id']}" class="btnLook">订单结算</a>
					{if $vo['shipping_status'] == 1  && $vo['status'] != 10}
						<a title="确实要完成这个订单?" href="{:U('Order/confirm_status',array('id'=>$vo['id']))}" class="btnSelect" target="ajaxTodo" title="确定要确定吗?">确定订单完成</a>
					{/if}
				</td>
			</tr>
</volist>
{/if}
		</tbody>
	</table>
	</div>
<include file="Index:pages" />
</div>
<script>
function o2o_print(){	  
	var ids =document.getElementsByName("o2oids[]");
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }      
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Print&a=o2o_print&ids="+oids);
	}
}
function o2o_psdprint(){
	var ids =document.getElementsByName("o2oids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Print&a=o2o_psdprint&ids="+oids);
	}
}
</script>
